<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jsDataEngine Test</title>


<script type="text/javascript" src="jsDataEngine.js"></script>



</head>
<body>


<script>
var ig=new ig_prefs('nameSpace');
var ig2=new ig_prefs('nameSpace2');
</script>

<script>
ig.set('globalScope.key_1','value from global');
ig.set('globalArr.[key1].[key2].[key3]','fromGlobal Array value');

function localScope(){
ig.set('key_1','value from local');
ig.set('loc.key_1','value from local obj');
ig.set('obj1.obj2.obj3.key1','value 2');

ig2.set('obj1.obj2.obj3.obj4','namespace2 values');
}
localScope();
</script>


<script>


//save somewhere to database
//saves all
ig.save();
</script>



<script>
console.log('globalScope is '+ig.get('globalScope'));
console.log('globalScope.key_1 is '+ig.get('globalScope.key_1'));


console.log('globalArr is '+ig.get('globalArr'));
console.log('globalArr[key1][key2] is '+ig.get('globalArr[key1][key2]'));
console.log('globalArr[key1][key2][key3] is '+ig.get('globalArr[key1][key2][key3]'));
console.log('globalArr.key1.key2.key3 is '+ig.get('globalArr.key1.key2.key3'));


console.log('key_1 is '+ig.get('key_1'));
console.log('loc.key_1 is '+ig.get('loc.key_1'));
console.log('obj1 is '+ig.get('obj1'));
console.log('obj1.obj2 is '+ig.get('obj1.obj2'));
console.log('obj1.obj2.obj3 is '+ig.get('obj1.obj2.obj3'));
console.log('obj1.obj2.obj3.key1 is '+ig.get('obj1.obj2.obj3.key1'));



console.log('storage: '+JSON.stringify(ig.storage) );
console.log('storage2: '+JSON.stringify(ig2.storage) );


</script>

<pre id="json">
storage: {"
    nameSpace":{"
        globalScope":{"
            key_1":"value from global"
        },
        "globalArr":{
            "key1":{
                "key2":{
                    "key3":"fromGlobal Array value"
                }}
            },
        "key_1":"value from local",
        "loc":{
            "key_1":"value from local obj"
        },
        "obj1":{
            "obj2":{
                "obj3":{
                    "key1":"value 2"
                }
            }
        },
        "a":{
            "1":{
                "a":{
                    "2":{
                        "a":{
                            "3":"aAa string value"
                            }
                        }
                    }
                }
            }
        }
    }
    
storage2: {
    "nameSpace2":{
        "obj1":{
            "obj2":{
                "obj3":{
                    "obj4":"namespace2 values"
                    }
                }
            }
        }
    }
    
</pre>






</html>
